/****************************************************************************************
**  File: Settings.hpp
**  Author: Asteroth
**  Date: 9-mag-2009
****************************************************************************************/

#ifndef __SETTINGS_HPP__
#define __SETTINGS_HPP__

class Settings {
private:
	int _minAliasedPointSize, _maxAliasedPointSize;
	int _minAliasedLineWidth, _maxAliasedLineWidth;
	int _minAntialiasedPointSize, _maxAntialiasedPointSize;
	int _minAntialiasedLineWidth, _maxAntialiasedLineWidth;
	int _redBits, _greenBits, _blueBits, _alphaBits, _depthBits, _stencilBits;
	int _maxElementIndices, _maxElementVertices;
	int _maxLights;
	int _maxTextureSize;
	int _maxViewportWidth, _maxViewportHeight;


	int _maxTextureUnits;

public:
	Settings() {
		GLint resi[2];
		glGetIntegerv(GL_ALIASED_POINT_SIZE_RANGE, resi);
		_minAliasedPointSize = resi[0];
		_maxAliasedPointSize = resi[1];
		glGetIntegerv(GL_ALIASED_LINE_WIDTH_RANGE, resi);
		_minAliasedLineWidth = resi[0];
		_maxAliasedLineWidth = resi[1];
		glGetIntegerv(GL_SMOOTH_POINT_SIZE_RANGE, resi);
		_minAntialiasedPointSize = resi[0];
		_maxAntialiasedPointSize = resi[1];
		glGetIntegerv(GL_SMOOTH_LINE_WIDTH_RANGE, resi);
		_minAntialiasedLineWidth = resi[0];
		_maxAntialiasedLineWidth = resi[1];
		glGetIntegerv(GL_RED_BITS, resi);
		_redBits = resi[0];
		glGetIntegerv(GL_GREEN_BITS, resi);
		_greenBits = resi[0];
		glGetIntegerv(GL_BLUE_BITS, resi);
		_blueBits = resi[0];
		glGetIntegerv(GL_ALPHA_BITS, resi);
		_alphaBits = resi[0];
		glGetIntegerv(GL_DEPTH_BITS, resi);
		_depthBits = resi[0];
		glGetIntegerv(GL_STENCIL_BITS, resi);
		_stencilBits = resi[0];
		glGetIntegerv(GL_MAX_ELEMENTS_INDICES, resi);
		_maxElementIndices = resi[0];
		glGetIntegerv(GL_MAX_ELEMENTS_VERTICES, resi);
		_maxElementVertices = resi[0];
		glGetIntegerv(GL_MAX_LIGHTS, resi);
		_maxLights = resi[0];
		glGetIntegerv(GL_MAX_TEXTURE_SIZE, resi);
		_maxTextureSize = resi[0];
		glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, resi);
		_maxTextureUnits = resi[0];
		glGetIntegerv(GL_MAX_VIEWPORT_DIMS, resi);
		_maxViewportWidth = resi[0];
		_maxViewportHeight = resi[1];
	}

	/// Returns the smallest supported size for aliased points.
	inline int minAliasedPointSize() {
		return _minAliasedPointSize;
	}

	/// Returns the largest supported size for aliased points.
	inline int maxAliasedPointSize() {
		return _maxAliasedPointSize;
	}

	/// Returns the smallest supported width for aliased lines.
	inline int minAliasedLineWidth() {
		return _minAliasedLineWidth;
	}

	/// Returns the largest supported width for aliased lines.
	inline int maxAliasedLineWidth() {
		return _maxAliasedLineWidth;
	}

	/// Returns the smallest supported width for antialiased points.
	inline int minAntialiasedPointSize() {
		return _minAntialiasedPointSize;
	}

	/// Returns the largest supported width for antialiased points.
	inline int maxAntialiasedPointSize() {
		return _maxAntialiasedPointSize;
	}

	/// Returns the smallest supported width for antialiased lines.
	inline int minAntialiasedLineWidth() {
		return _minAntialiasedLineWidth;
	}

	/// Returns the largest supported width for antialiased lines.
	inline int maxAntialiasedLineWidth() {
		return _maxAntialiasedLineWidth;
	}

	/// Returns the number of red bitplanes in the color buffer.
	inline int redBits() {
		return _redBits;
	}

	/// Returns the number of green bitplanes in the color buffer.
	inline int greenBits() {
		return _greenBits;
	}

	/// Returns the number of blue bitplanes in the color buffer.
	inline int blueBits() {
		return _blueBits;
	}

	/// Returns the number of alpha bitplanes in the color buffer.
	inline int alphaBits() {
		return _alphaBits;
	}

	/// Returns the number of bitplanes in the depth buffer.
	inline int depthBits() {
		return _depthBits;
	}

	/// Returns the number of bitplanes in the stencil buffer.
	inline int stencilBits() {
		return _stencilBits;
	}

	/// Returns the recommended maximum number of vertex array indices.
	inline int maxElementIndices() {
		return _maxElementIndices;
	}

	/// Returns the maximum number of lights.
	inline int maxLights() {
		return _maxLights;
	}

	/// Returns the recommended maximum number of vertex array vertices.
	inline int maxElementVertices() {
		return _maxElementVertices;
	}

	/// Returns the largest texture size that the video card can handle.
	inline int maxTextureSize() {
		return _maxTextureSize;
	}

	/// Returns the maximum number of textures that can be used in multitexturing.
	inline int maxTextureUnits() {
		return _maxTextureUnits;
	}

	/// Returns the maximum supported width of the viewport.
	inline int maxViewportWidth() {
		return _maxViewportWidth;
	}

	/// Returns the maximum supported height of the viewport.
	inline int maxViewportHeight() {
		return _maxViewportHeight;
	}
};

#endif
